//
//  HKLNavigationController.m
//  charity
//
//  Created by san_xu on 2016/12/27.
//  Copyright © 2016年 com.charity.huakala. All rights reserved.
//

#import "HKLNavigationController.h"

#define KChar_Size 16//标题文字大小

@interface HKLNavigationController ()

@end

@implementation HKLNavigationController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //初始化界面
    [self initUserInterface];
}

//初始化界面
- (void)initUserInterface {
    //设置导航栏颜色、去掉半透明效果
    [self.navigationBar setTranslucent:NO];
    self.navigationBar.barTintColor = kNavColor;
    
    //设置导航栏标题文字的颜色
    NSMutableDictionary * titleDic = [NSMutableDictionary dictionary];
    titleDic[NSForegroundColorAttributeName] = [UIColor whiteColor];
    titleDic[NSFontAttributeName] = [UIFont systemFontOfSize:KChar_Size];
    self.navigationBar.titleTextAttributes = titleDic;

}

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
    
    //如果是非栈底控制器就隐藏底部Dock操作条
    if (self.childViewControllers.count>0) {
        viewController.hidesBottomBarWhenPushed=YES;
        
        // 设置导航栏按钮
        viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[[UIImage imageNamed:@"navigationbar_arrowBack"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] style:UIBarButtonItemStylePlain target:self action:@selector(back)];
    }
    [super pushViewController:viewController animated:animated];
    
}

//后退
-(void)back
{
    [self popViewControllerAnimated:YES];
}

@end
